package com.cvs.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.cvs.model.DaysEntity;
import com.cvs.model.MandatoryEntity;
import com.cvs.services.ChmService;

@Controller
public class ViewController {
	
	@Autowired
	private ChmService controllerService;
	
	public ChmService getControllerService() {
		return controllerService;
	}

	public void setControllerService(ChmService controllerService) {
		this.controllerService = controllerService;
	}
	
	
	@RequestMapping(value ="/view", method = RequestMethod.GET)
	 public String getViewPage(ModelMap model, HttpSession session) {

		List<DaysEntity> days = new ArrayList<DaysEntity>();
		days = controllerService.getApprovedHols();
		
		List<MandatoryEntity> mandatory = new ArrayList<MandatoryEntity>();
		mandatory = controllerService.getMandatoryDays();
		
		 model.addAttribute("mandatory", mandatory);
		 model.addAttribute("days", days);
				 return "view";
	    }
	
	
}